
function orgnizerWizard(module)
{
    var jsondata;

    var classlist_str = "";

    var tabletools = new TableTools();

    function columns(){//班级表格列信息
        return [
            {
                field: 'state',
                checkbox: true

            },{
                field:'class_str',
                title:'分组名称'
            },{
                field:'class_json',
                title:'操作',
                formatter:Formatter
            },{
                field:'count',
                title:'下属人数'
            }];
    }


    function Formatter(value, row, index)
    {
        return '<a href="#" class="btn btn-success btn-sm showclassinfo_btn"><span class="class_json_span" style="display: none;">'+value+'</span>显示成员</a>';
    }

    tabletools.bstable("classinfo-table", module+"/Orgnizer/getClassArray", columns(), null, "");


    $('#classinfo-table').on('load-success.bs.table', function () {
        // alert();
        $("#classinfo-table").find('tbody').find('tr').each(function(){
            if ($(this).find('td').eq(3).html() == -2){
                $(this).remove();
            }

            // alert($(this).find('td').eq(3).html());

        });
    });





    $(document).on('click', ".showclassinfo_btn", function(){
        var class_jsonstr = $(this).find('span').text();

        function users_columns()
        {
            return [
                {
                    field:'uid',
                    title:'uid'
                },{
                    field:'username',
                    title:'用户名'
                },{
                    field:'email',
                    title:'邮箱'
                },{
                    field:'class',
                    title:'组织信息'
                }];
        }

        function QueryParams(para){//返回选定班级信息的人员信息查询json数组
            var querydata = {
                searchkey:class_jsonstr
            };
            return querydata;
        }


        $("#class_userinfo_modal").modal('show');
        tabletools.bstable("class_userinfo_table", module+"/Orgnizer/getUserList", users_columns(), QueryParams,"");


    });




    $("#add_selectedclass").click(function(){
        var data = $('#classinfo-table').bootstrapTable('getAllSelections');
        var class_list = {};
        var k = 0;

        if (data.length == 0){
            alert("没有选择任何单位！");
            return false;
        }

        for(var i = 0; i < Object.keys(data).length; i++){
            if (data[i].count == 0){
                alert("所选单位下属人数为0！");
                location.reload();
                return false;
            }

            classlist_str += data[i].class_json;


        }

        json_classlist = JSON.stringify(class_list);
        $(".btn-next").removeClass("disabled");
        $(".btn-next").trigger('click');
        $(".btn-next").trigger('click');

        alert("成功添加所选分组，点击右上角下一步继续");

    });



    $("#test_checkbox").click(function(){
        alert($("#checkbox_quiz16pf").hasClass("checked"));
    });


    $("#commit_quiz").click(function(){

        var isvisible = 0;
        var k = 0;
        var submited_quizlist = {};

        if ($("#checkbox_quiz16pf").hasClass("checked")){
            submited_quizlist[k++] = "16pf_test";
        }
        if ($("#checkbox_quizwippf").hasClass("checked")){
            submited_quizlist[k++] = "wippf_demo";
        }
        if ($("#checkbox_quizmbti").hasClass("checked")){
            submited_quizlist[k++] = "mbti";
        }
        if ($("#checkbox_quizdisc").hasClass("checked")){
            submited_quizlist[k++] = "DISC";
        }



        if ($("#checkbox_isvisible").hasClass("checked")){
            isvisible = 1;
        }




        var ajax_data = {
            json_quiz_list:JSON.stringify(submited_quizlist),
            classlist_str:classlist_str,
            isvisible:isvisible,
            quiztitle:$("#quiz_title").val(),
            quizinfo:$("#quizinfo").val()
        };


        console.log(ajax_data);



        //console.log(jsondata);
        $.ajax({
            type: "POST",
            url: module +  "/Orgnizer/newQuiz",
            dataType: "json",
            async: false,
            data: ajax_data,
            success: function (data) {
                if (data.code == 1)
                    alert(data.msg);
                else
                    alert("添加新测试失败："+data.msg);

            }, error: function (jqXHR) {
                alert("添加问卷失败failed" + jqXHR.status);
            }
        });
    });

}

$(document).ready(function(){







});